/* import React, { Component } from 'react';

class index extends Component {
    constructor(props) {
        super(props)
    
        this.state = {
            
        }
        this.isInClietn = this.isInClietn.bind(this)
    }
    
    useEffect(() => {
        // throttl 是js节流函数，具体请参考lodash.js工具库
        window.addEventListener('scroll', throttle(checkAllImags));
        return () => {
        window.removeEventListener('scroll', throttle(checkAllImags));
        }
    },[]) 
    useEffect(()=>{
        // create
            window.addEventListener('scroll',handleScroll);
        return ()=>{
        // destroy
            window.removeEventListener('scroll',handleScroll);
        }
        // deps
        },[count]);
    isInClietn(el){
        // 获取元素
        let eldom = document.querySelector(el);
        // 获取元素具体视窗的距离
        let { top, right, bottom, left } = eldom.getBoundingClientRect();
        // 浏览器窗口
        let clientHeight = window.innerHeight;
        let clientWidth = window.innerWidth;
        return !(top > clientHeight || bottom < 0 || left > clientWidth || right < 0);
    }
    
    checkAllImags(){
        var imgs = document.querySelectorAll('img');
        let index = 0;
        Array.from(imgs).map((item, inx)=>{
        if (this.isInClietn(item) && inx > index) {
            let eldom = document.querySelector(item);
            eldom.src = eldom.getAttribute('data-src');
            index = inx + 1;
        }
        })
    }
    render() {
        return (
            <div>
                
            </div>
        );
    }
}

export default index;*/